#include <bits/stdc++.h>
using namespace std;

#define rep(i,n) for(int i=0; i<n; i++)
#define repb(i,n) for(int i=n-1; i>=0; i--)
#define REP(i,a,b) for(int i=a; i<=b; i++)
#define REPB(i,a,b) for(int i=a; i>=b; i--)
#define pb push_back
#define mp make_pair
#define tc(t) int t; scanf("%d",&t); while(t--)

int main()
{
	//#ifndef LOCAL
	freopen("duel.in","r",stdin);
	freopen("duel.out","w",stdout);
	//#endif
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n;
	int a[100005]={0};
	int x;
	cin>>n;
	rep(i,n)
	{
		cin>>x;
		a[x]++;
	}
	vector<int> srt;
	REP(i,1,100000)
		if(a[i]!=0)
			srt.pb(a[i]);
	vector<int> avl(srt);
	//for(auto i:srt) cerr<<i<<" ";
	int atk=0,posd=0,posa=1,len=srt.size();
	//cerr<<endl<<len<<endl;
	while(posa<len)
	{
		//cerr<<"posd="<<setw(3)<<posd<<", posa="<<setw(3)<<posa<<", srt[posd]="<<setw(6)<<srt[posd]<<", avl[posa]="<<setw(6)<<avl[posa]<<"; ";
		if(srt[posd]<=avl[posa]){
			atk+=srt[posd],posd++;
			avl[posa]-=srt[posd];
			if(posd==posa) posa++;
			//cerr<<"atk+=srt[posd], atk="<<setw(6)<<atk<<", avl[posa]-=srt[posd].\n";
		}
		else
			atk+=avl[posa],srt[posd]-=avl[posa],posa++;//,cerr<<"atk+=avl[posa], atk="<<setw(6)<<atk<<", srt[posd]-=avl[posa].\n";
	}
	//cerr<<"ans="<<n-atk<<endl;
	cout<<n-atk<<endl;
	return 0;
}
